package gui.panel;

import gui.entity.Record;
import gui.services.RepotService;
import gui.util.ChartUtil;
import gui.util.GUIUtil;

import javax.swing.*;

import java.awt.*;
import java.util.List;
public class ReportPanel extends WorkingPanel {
    static {
        GUIUtil.useLNF();
    }

    public static ReportPanel instance = new ReportPanel();

    public JLabel l = new JLabel();

    public ReportPanel() {
        this.setLayout(new BorderLayout());
        Image i = ChartUtil.getImage(400, 300);
        ImageIcon icon= new ImageIcon(i);
        l.setIcon(icon);
        this.add(l);
        addListener();
    }


    @Override
    public void updateData() throws Exception {
        List<Record> rs = new RepotService().listThisMonthRecords();
        Image i = ChartUtil.getImage(rs, 350, 250);
        ImageIcon icon = new ImageIcon(i);
        l.setIcon(icon);

    }

    @Override
    public void addListener() {

    }
}
